 
 
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>表白墙 - 爱就大胆说出来</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" th:href="@{/res/layui/css/layui.css}">
  <link rel="stylesheet" th:href="@{/res/css/global.css}">
</head>
<body>

<div class="fly-header layui-bg-black" th:include="common/header.html :: head"></div>
<br>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">

      <div class="fly-panel" style="margin-bottom: 0;">
        
        <div class="fly-panel-title fly-filter">
          <a href="/">最新</a>
          <span class="fly-mid"></span>
          <a href="" class="layui-this">关注</a>
          <span class="fly-mid"></span>
        </div>

        <ul class="fly-list" id="flag">
          <li th:each="post:${postList}">
            <a th:href="@{/user/home/{uid}(uid=${post.getUser().getUserId()})}" th:if="${post.getPostType()} ne '0'" class="fly-avatar">
              <img th:src="@{{head}(head=${post.getUser().getHead()})}" >
            </a>
            <a th:if="${post.getPostType()} eq '0'" class="fly-avatar">
              <img th:src="@{/res/images/avatar/00.jpg}" >
            </a>
            <h2>
              <a th:href="@{/post/detail/{pid}(pid=${post.getPostId()})}" th:text="${post.getPostAbstract()}"></a>
            </h2>
            <div class="fly-list-info">
              <a th:href="@{/user/home/{uid}(uid=${post.getUser().getUserId()})}" link>
                <cite th:if="${post.getPostType()} eq '0'" th:text="匿名用户"></cite>
                <cite th:if="${post.getPostType()} ne '0'" th:text="${post.getUser().getNickname()}"></cite>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() lt 600 and post.getUser().getExperience() ge 0 and post.getPostType() ne 0}" th:text="Lv1"></i>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() lt 2000 and post.getUser().getExperience() ge 600 and post.getPostType() ne 0}" th:text="Lv2"></i>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() lt 4000 and post.getUser().getExperience() ge 2000 and post.getPostType() ne 0}" th:text="Lv3"></i>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() lt 10000 and post.getUser().getExperience() ge 4000 and post.getPostType() ne 0}" th:text="Lv4"></i>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() lt 20000 and post.getUser().getExperience() ge 10000 and post.getPostType() ne 0}" th:text="Lv5"></i>
                <i class="layui-badge fly-badge-vip" th:if="${post.getUser().getExperience() ge 20000}" th:text="Lv6"></i>
              </a>
              <span class="fly-list-nums">
                  <i class="iconfont icon-zan" title="赞"></i><span th:text="${post.getPostLikedCount()}"></span>
                  <i class="iconfont icon-pinglun1" title="回复"></i><span th:text="${post.getAnswerCount()}"></span>
                  <i class="iconfont" title="浏览">&#xe60b;</i><span th:text="${post.getPostVisitedCount()}"></span>
              </span>
            </div>
            <div class="fly-list-badge">
              <span class="layui-badge layui-bg-red" th:if="${post.getPostType()} eq '1' or ${post.getPostType()} eq '0'">表白</span>
              <span class="layui-btn layui-btn-xs jie-admin" th:if="${post.getPostType()} eq '2'">分享</span>
              <span class="layui-badge fly-badge-qiangreen" th:if="${post.getPostType()} eq '3'">吐槽</span>
            </div>
          </li>
<!--            <a id="flag"></a>-->
        </ul>

        <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;" th:if="${#lists.isEmpty(postList)}">
          <i style="font-size:14px;">您还没关注任何人，或者您关注的人没发表任何内容o(´^｀)o</i>
        </div>

<!--        <div style="text-align: center" th:if="not ${#lists.isEmpty(postList)}">-->
<!--          <div class="laypage-main" id="pageDiv">-->
<!--            <a href="javascript:void(0);" id="more-post" class="laypage-first" title="查看更多" th:if="${session.pageUtil.isHasNextPage()}">查看更多</a>-->
<!--            <a href="javascript:void(0);" class="laypage-first" title="已经到底了" th:if="not ${session.pageUtil.isHasNextPage()}">已经到底了</a>-->
<!--          </div>-->
<!--        </div>-->

          <div style="text-align: center" id="pageDiv" th:if="not ${#lists.isEmpty(postList)}">
              <button id="more-post" type="button" class="layui-btn layui-btn-primary" th:if="${session.pageUtil.isHasNextPage()}">查看更多</button>
              <button type="button" class="layui-btn layui-btn-primary" th:if="not ${session.pageUtil.isHasNextPage()}">已经到底了</button>
          </div>

          <br>

      </div>
    </div>
    <div class="layui-col-md4">

      <div class="fly-panel">
        <h3 class="fly-panel-title">温馨公告</h3>
        <ul class="fly-panel-main fly-list-static">
          <li th:each="notice:${noticeList}">
            <a th:href="@{notice/detail/{nid}(nid=${notice.getNoticeId()})}" target="_blank" th:text="${notice.getTitle()}"></a>
          </li>
        </ul>
      </div>


      <div class="fly-panel fly-signin">
      <div class="fly-panel-title">
        签到
        <i class="fly-mid"></i>
        <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
        <i class="fly-mid"></i>
        <a href="javascript:;" class="fly-link" id="LAY_signinTop">飞吻榜<span class="layui-badge-dot"></span></a>
        <span class="fly-signin-days">已连续签到<cite th:if="${user!=null}" th:text="${user.getSignedCount()}"></cite>天</span>
      </div>
      <div class="fly-panel-main fly-signin-main" th:if="${user!=null}">
        <button class="layui-btn layui-btn-danger" id="LAY_signin" th:if="not ${isSignIn}">今日签到</button>
<!--        <span  th:if="not ${isSignIn}">可获得<cite>5</cite>飞吻</span>-->

        <!-- 已签到状态 -->
        <button class="layui-btn layui-btn-disabled"  th:if="${isSignIn}">今日已签到</button>
<!--        <span  th:if="${isSignIn}">获得了<cite>20</cite>飞吻</span>-->
      </div>
      <div class="fly-panel-main fly-signin-main" th:if="${user==null}">
        <span>请先登录</span>
      </div>
    </div>

      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">本周热议</dt>
        <dd th:each="hot:${hotList}">
          <a th:href="@{post/detail/{pid}(pid=${hot.getPostId()})}" th:text="${hot.getPostAbstract()}"></a>
          <i class="iconfont icon-pinglun1" title="回复"></i><span th:text="${hot.getAnswerCount()}"></span>
        </dd>

        <!-- 无数据时 -->
        <!--<img th:src="@{{headurl}(headurl=${post.getUser().getHead()})}" >
        <div class="fly-none">没有相关数据</div>
        -->
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          使用过程遇到问题或提建议请联系开发者
        </div>
        <div class="fly-panel-main">
          <img th:src="@{/res/images/weixin.jpg}" style="max-width: 40%;float: left" alt="layui">
          <img th:src="@{/res/images/qq.jpg}" style="max-width: 36%;" alt="layui" >
        </div>
      </div>
      
      <div class="fly-panel fly-link">
        <h3 class="fly-panel-title">开发者链接</h3>
        <dl class="fly-panel-main">
          <dd><a href="https://github.com/EGbulingbuling" target="_blank">开发者github</a><dd>
          <dd><a href="https://gitee.com/lixuhaoeg" target="_blank">开发者码云</a><dd>
          <dd><a href="https://blog.csdn.net/q2051190945" target="_blank">开发者博客</a><dd>
        </dl>
      </div>

    </div>
  </div>
</div>

<div class="fly-footer" th:include="common/footer.html :: foot"></div>
<script th:src="@{/res/layui/layui.js}"></script>
<script th:inline="javascript">
    layui.cache.page = 'jie';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '../../res/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '../../res/mods/'
    }).extend({
        fly: 'index'
    }).use('fly');

    layui.use(['jquery'], function(){
      var $=layui.jquery;

        /**
         *
         * 我前端学的贼差，原谅我写的狗屎代码
         *
         */
        $("#more-post").click(function(){
          $.ajax({
              url:"morePost",
              method:"get",
              success:function(data){
                var morePost="";
                for (var temp in data.postList){
                    morePost+="<li>";
                    if (data.postList[temp].postType != 0) {
                        morePost+="<a href=\"user/home/"+data.postList[temp].user.userId+"\" class=\"fly-avatar\">" +
                            "<img src=\""+data.postList[temp].user.head+"\" >" +
                            "</a>";
                    }else {
                        morePost+="<a class=\"fly-avatar\">" +
                            "       <img src=\"/res/images/avatar/00.jpg\" >" +
                            "</a>";
                    }
                    morePost+="<h2>" +
                                "<a href=\"post/detail/"+data.postList[temp].postId+"\" >"+data.postList[temp].postAbstract+"</a>" +
                            "</h2>";
                    morePost+="<div class=\"fly-list-info\">" +
                        "              <a href=\"user/home/"+data.postList[temp].user.userId+"\" link>";
                    if (data.postList[temp].postType != 0){
                        morePost+="                <cite>"+data.postList[temp].user.nickname+"</cite>";
                    }else {
                        morePost+="                <cite>匿名用户</cite>";
                    }
                    if (data.postList[temp].postType != 0) {
                        if(data.postList[temp].user.experience>=0&&data.postList[temp].user.experience<600){
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv1</i>";
                        }else if(data.postList[temp].user.experience>=600&&data.postList[temp].user.experience<2000){
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv2</i>";
                        }else if(data.postList[temp].user.experience>=2000&&data.postList[temp].user.experience<4000){
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv3</i>";
                        }else if(data.postList[temp].user.experience>=4000&&data.postList[temp].user.experience<10000){
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv4</i>";
                        }else if(data.postList[temp].user.experience>=10000&&data.postList[temp].user.experience<20000){
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv5</i>";
                        }else{
                            morePost+="<i class=\"layui-badge fly-badge-vip\">Lv6</i>";
                        }
                    }
                    morePost+="              </a>" +
                        "              <span class=\"fly-list-nums\">" +
                        "                  <i class=\"iconfont icon-zan\" title=\"赞\"></i><span>"+data.postList[temp].postLikedCount+"</span>" +
                        "                  <i class=\"iconfont icon-pinglun1\" title=\"回复\"></i><span>"+data.postList[temp].answerCount+"</span>" +
                        "                  <i class=\"iconfont\" title=\"浏览\">&#xe60b;</i><span>"+data.postList[temp].postVisitedCount+"</span>" +
                        "              </span>" +
                        "            </div>"+
                        "<div class=\"fly-list-badge\">";
                    if(data.postList[temp].postType==0||data.postList[temp].postType==1){
                        morePost+="<span class=\"layui-badge layui-bg-red\">表白</span>";
                    }else if(data.postList[temp].postType==2){
                        morePost+="<span class=\"layui-btn layui-btn-xs jie-admin\">分享</span>";
                    }else if(data.postList[temp].postType==3){
                        morePost+="<span class=\"layui-badge fly-badge-qiangreen\">吐槽</span>";
                    }
                    morePost+="</div>"+
                    "</li>";
                }
                $("#flag").append(morePost);
                if (data.pageUtil.hasNextPage == false) {
                    $("#more-post").remove();
                    $("#pageDiv").append("<button type=\"button\" class=\"layui-btn layui-btn-primary\" >已经到底了</button>");
                }
              },
              error:function(data){
                layer.msg("服务器繁忙，请稍后再试");
              }
          });
      });
    });
</script>

</body>
</html>